package com.example.makerspace.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.makerspace.domain.MeetingCategoryDO;
import com.example.makerspace.dto.Pagination;
import com.example.makerspace.mapper.MeetingCategoryMapper;
import com.example.makerspace.mapper.MeetingMapper;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;


@Component
public class MeetingCategoryDAO  extends  BaseDAO<MeetingCategoryDO> {
    @Resource
    private MeetingCategoryMapper meetingCategoryMapper;

    @PostConstruct
    public void init(){
        this.mapper = meetingCategoryMapper;
    }

    public IPage<MeetingCategoryDO> selectByPage(Pagination pagination) {
        QueryWrapper<MeetingCategoryDO> wrapper = new QueryWrapper<>();
        return  mapper.selectPage(new Page<>(pagination.getPageNum(),pagination.getSize()),wrapper);
    }
}
